package org.flashbrighton.as3bots.bots
{
	import org.flashbrighton.as3bots.components.ChassisSize;
	import org.flashbrighton.as3bots.components.ExtraComponents;
	import org.flashbrighton.as3bots.events.HitBombEvent;
	import org.flashbrighton.as3bots.events.HitBotEvent;
	import org.flashbrighton.as3bots.events.HitWallEvent;
	import org.flashbrighton.as3bots.events.ScanBotEvent;
	import org.flashbrighton.as3bots.models.BotData;
	
	public class JoesBot extends BaseBot
	{		
		private var state:String;
		private var health:Number;

		public function JoesBot()
		{
			super(ExtraComponents.TURBO, 0x95B4E2, ChassisSize.LARGE);
			enginePower = -1.0;
			steeringPower = -0.5;
			state = "good";
		}
		
		override public function onHitBot(event:HitBotEvent):void
		{
			
			if (event.collisionPoint > 0.5 || event.collisionPoint < -0.5)
			{
				state = "bad";
			}
			else
			{
				state = "good";
			}
			
			if (state == "bad")
			{		
				enginePower = -enginePower;
				steeringPower = Math.random();
				state = "good";
			}
			else if (state == "good")
			{
				steeringPower = 0;
			}
		}
		
		override public function onHitWall(event:HitWallEvent):void
		{			
			state = "bad";
			
			if (state == "bad")
			{		
				enginePower = -enginePower;
				steeringPower = Math.random();
				state = "good";
			}
			else if (state == "good")
			{
				steeringPower = 0;
			}
		}		
		
		override public function update(data:BotData):void
		{
		}
		
				
		override public function onScanBot(event:ScanBotEvent):void
		{
			// TODO Auto Generated method stub
			
		}

		override public function onHitBomb(event:HitBombEvent):void
		{
		}
		
	}
}